﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Details_maker : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = 1;
        if (Request.QueryString["id"] != null)
        {
            id = int.Parse(Request.QueryString["id"]);
        }

        DataClassesDataContext db = new DataClassesDataContext();
        var makers =
            from m in db.Makers where m.MAKER_ID == id
            select new { m.NAAM, m.BESCHRIJVING, m.LOGO };

        var resultaten = makers.ToArray();
        title_text.Text = "<h2>" + resultaten[0].NAAM + "</h2>";
        cover.ImageUrl = resultaten[0].LOGO;
        beschrijving_text.Text = resultaten[0].BESCHRIJVING;

        var games =
            from g in db.Games
            join m in db.Makers on g.MAKER_ID equals m.MAKER_ID
            join p in db.Platforms on g.PLATFORM_ID equals p.PLATFORM_ID
            where m.MAKER_ID == id
            select new { g.GAME_NR, g.TITEL, g.BESCHRIJVING, g.BESTANDSGROOTTEGAME, m.MAKER_ID, m.NAAM, p.OMSCHRIJVING, g.PRIJS, g.IMAGE };

        GridView1.DataSource = games;
        GridView1.DataBind();
        
        
    }
    protected void cover_Click(object sender, ImageClickEventArgs e)
    {
        
    }
    //pagina nummers regelen voor gridview1
    protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }
}
